import {TABBARS_CACHE} from '@/utils/enums.js'
const initData = [
				{
					pagePath: '/pages/index/index',
					iconPath: 'home',
					selectedIconPath: 'home-fill',
					text: '首页',
					isDot: true,
					customIcon: false,
					auth:'a1'
				},
				{
					pagePath: '/pages/mine/mine',
					iconPath: 'account',
					selectedIconPath: 'account-fill',
					text: '个人主页',
					customIcon: false,
					auth:'a2'
				}
			]
export default {
	state:{
		list: []
	},
	mutations:{
		SET_TABBARS(state,list){
			state.list = list
			uni.setStorageSync(TABBARS_CACHE,list)
		}
	},
	actions:{
		add_tabbars({commit},auths){
			const list = initData.filter(v=>auths.includes(v.auth))
			console.log('/store/modules/tabbar:底部tabbars生成的数量')
			console.table(list)
			commit('SET_TABBARS',list)
		}
	},
	getters:{
		getTabbars(state){
			return state.list || uni.getStorageSync(TABBARS_CACHE)
		}
	}
}